<?php echo $this->Html->script('Instituicao'); ?>
<div id="msg"></div>
<form action="/siscel/instituicaoLabs/pesquisar" id="INSTITUICAOPesquisarForm" method="post">
    <fieldset>
        <legend>Unidades</legend>
        <input type="hidden" name="_method" value="POST"/>
        <table width="98%" border="0" cellspacing="0" cellpadding="2">
            <thead>
                <th colspan="4">
                    <b></b>
                </th>
            </thead>
            <tr>
                <td>
                    <?php echo $this->Form->input('INSTITUICAO.NM_INST', array('type' => 'text', 'label' => 'Nome', 'id' => 'txtNome', 'class' => 'campoAlfa', 'size' => "30", 'maxlength' => "100")); ?>
                </td>
                <td>
                    <?php echo $this->Form->input('INSTITUICAO.NM_INST_CURTO', array('type' => 'text', 'label' => 'Nome curto', 'id' => 'txtNomeCurto', 'class' => 'campoAlfa', 'size' => "20", 'maxlength' => "15")); ?>
                </td>
                <td>
                    <?php echo $this->Form->input('UF.CD', array('type' => 'select', 'label' => 'UF', 'id' => 'txtUF', 'class' => '', 'options' => $arrUF)); ?>
                </td>
                <td>
                    <?php echo $this->Form->input('CIDADE.CD', array('type' => 'select', 'label' => 'Cidade', 'id' => 'txtCID', 'class' => '', 'options' => $arrCidade)); ?>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <?php
                        echo $this->Form->input('SOLICITACAO.TIPO', array('multiple' => 'checkbox', 'label' => 'Tipo', 'id' => 'txtC', 'options' => array('1'=>'Coletora','2'=>'Executora','3'=>'Solicitante') ));
                    ?>
                </td>
            </tr>
        </table>
        <div class="submit">
            <input id="btPesquisarMedico" type="submit" value="Pesqusiar"/>
        </div>    
    </fieldset>
</form>
<div id="tabelaPesquisa">
    <table id="tbResuldado" class="dataTable" border="0" cellspacing="0" cellpadding="0">
        <thead>
            <th></th>
        </thead>
        <tbody>
            <?php
            if(!empty($arrInstituicao)){ ?>
                <?php
                foreach($arrInstituicao as $v){ ?>
                    <tr>
                        <td>
                            <div style="width: 100%">
                                <div style="width: 10%;float: left;clear: right;">
                                    <a href="/siscel/instituicaoLabs/visualizar/<?php echo h($v['INSTITUICAOLAB']['CD_INST_LAB']); ?>">
                                        <?php
                                            if(!empty($v['INSTITUICAOLAB']['IM_FOTO'])){
                                                $this->Siscel->foto($v['INSTITUICAOLAB']['IM_FOTO'], 70, 70);
                                            }else{
                                                echo $this->Html->image('/img/perfil.jpg', array('width' => '70', 'height' => '70', 'label' => null, 'style' => 'border: 0;margin: 4px 8px;'));
                                            }
                                        ?>
                                    </a>
                                </div>
                                <div style="width: 90%;float: left;">
                                    <div style="float: left;clear: right;width: 100%;">
                                        <table style="width: 100%;border: 0;" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                              <td><b>Nome:</b> <a href="/siscel/instituicaoLabs/visualizar/<?php echo h($v['INSTITUICAOLAB']['CD_INST_LAB']); ?>"><?php echo h($v['INSTITUICAOLAB']['NM_INST']); ?></a></td>
                                              <td><b>Telefone:</b> <?php echo h($v[0]['TELEFONES']); ?></td>
                                              <td><b>Email:</b> <?php echo h($v['INSTITUICAOLAB']['DS_EMAIL_PRINCIPAL'].' '.$v['INSTITUICAOLAB']['DS_EMAIL_SECUNDARIO']); ?></td>
                                              <td>
                                                <img src="/siscel/img/bt_apagar.gif" onclick="Medico.excluiMedico('<?php echo h($v['INSTITUICAOLAB']['CD_INST_LAB']); ?>',false)" title="Excluir médico"/>
                                              </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="float: left;clear: right;width: 100%;">
                                        <table style="width: 100%;border: 0;" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                              <td colspan="2"><b>Endereço:</b> <?php echo h($v[0]['ENDERECOS']); ?></td>
                                              <td><b>Tipo: </b><?php echo h($v[0]['TP_SERVICO']); ?></td>
                                              <td></td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                <?php
                } ?>
                    <?php
            }
            ?>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        Instituicao.init();
    });
</script>